#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8

from sys import maxsize


class Solution:
    """
    @param prices: Given an integer array
    @return: Maximum profit
    """
    def maxProfit(self, prices):
        min_price = maxsize
        max_profit = 0

        if not prices:
            return 0

        # return max(prices) - min(prices)
        for p in prices:
            try_max_profit = p - min_price
            if try_max_profit > max_profit:
                max_profit = try_max_profit
            if p < min_price:
                min_price = p

        return max_profit

def main():
    print("start main")

if __name__ == "__main__":
    main()
